package com.saku.uiprojecttest

import android.os.Bundle
import android.support.design.widget.FloatingActionButton
import android.support.design.widget.Snackbar
import android.support.v7.app.AppCompatActivity
import android.support.v7.widget.Toolbar
import android.webkit.WebView
import android.widget.Button
import com.saku.uiprojecttest.R

class TestWebviewActivity : AppCompatActivity() {

    val url = "onetrav://rentcar/home"

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_test_webview2)
        val toolbar = findViewById(R.id.toolbar) as Toolbar?
        setSupportActionBar(toolbar)
        toolbar!!.title = "TestWebviewActivity"

        val fab = findViewById(R.id.fab) as FloatingActionButton?
        fab!!.setOnClickListener { view ->
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                    .setAction("Action", null).show()
        }

        val btnGo = findViewById(R.id.webview_btn) as Button
        btnGo.setOnClickListener {
            val webview = findViewById(R.id.webview) as WebView
            webview.settings.javaScriptEnabled = true

            webview.loadUrl(url)
        }
    }

}
